1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.Clamp; 26 27 private import adw.c.functions; 28 public import adw.c.types; 29 private import glib.ConstructionException; 30 private import gobject.ObjectG; 31 private import gtk.AccessibleIF; 32 private import gtk.AccessibleT; 33 private import gtk.BuildableIF; 34 private import gtk.BuildableT; 35 private import gtk.ConstraintTargetIF; 36 private import gtk.ConstraintTargetT; 37 private import gtk.OrientableIF; 38 private import gtk.OrientableT; 39 private import gtk.Widget; 40 41 42 /** 43 * A widget constraining its child to a given size. 44 * 45 * <picture> 46 * <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme: dark)"> 47 * <img src="clamp-wide.png" alt="clamp-wide"> 48 * </picture> 49 * <picture> 50 * <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)"> 51 * <img src="clamp-narrow.png" alt="clamp-narrow"> 52 * </picture> 53 * 54 * The `AdwClamp` widget constrains the size of the widget it contains to a 55 * given maximum size. It will constrain the width if it is horizontal, or the 56 * height if it is vertical. The expansion of the child from its minimum to its 57 * maximum size is eased out for a smooth transition. 58 * 59 * If the child requires more than the requested maximum size, it will be 60 * allocated the minimum size it can fit in instead. 61 * 62 * ## CSS nodes 63 * 64 * `AdwClamp` has a single CSS node with name `clamp`. 65 * 66 * Its children will receive the style classes `.large` when the child reached 67 * its maximum size, `.small` when the clamp allocates its full size to the 68 * child, `.medium` in-between, or none if it hasn't computed its size yet. 69 * 70 * Since: 1.0 71 */ 72 public class Clamp : Widget, OrientableIF 73 { 74 /** the main Gtk struct */ 75 protected AdwClamp* adwClamp; 76 77 /** Get the main Gtk struct */ 78 public AdwClamp* getClampStruct(bool transferOwnership = false) 79 { 80 if (transferOwnership) 81 ownedRef = false; 82 return adwClamp; 83 } 84 85 /** the main Gtk struct as a void* */ 86 protected override void* getStruct() 87 { 88 return cast(void*)adwClamp; 89 } 90 91 /** 92 * Sets our main struct and passes it to the parent class. 93 */ 94 public this (AdwClamp* adwClamp, bool ownedRef = false) 95 { 96 this.adwClamp = adwClamp; 97 super(cast(GtkWidget*)adwClamp, ownedRef); 98 } 99 100 // add the Orientable capabilities 101 mixin OrientableT!(AdwClamp); 102 103 104 /** */ 105 public static GType getType() 106 { 107 return adw_clamp_get_type(); 108 } 109 110 /** 111 * Creates a new `AdwClamp`. 112 * 113 * Returns: the newly created `AdwClamp` 114 * 115 * Since: 1.0 116 * 117 * Throws: ConstructionException GTK+ fails to create the object. 118 */ 119 public this() 120 { 121 auto __p = adw_clamp_new(); 122 123 if(__p is null) 124 { 125 throw new ConstructionException("null returned by new"); 126 } 127 128 this(cast(AdwClamp*) __p); 129 } 130 131 /** 132 * Gets the child widget of @self. 133 * 134 * Returns: the child widget of @self 135 * 136 * Since: 1.0 137 */ 138 public Widget getChild() 139 { 140 auto __p = adw_clamp_get_child(adwClamp); 141 142 if(__p is null) 143 { 144 return null; 145 } 146 147 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 148 } 149 150 /** 151 * Gets the maximum size allocated to the child. 152 * 153 * Returns: the maximum size to allocate to the child 154 * 155 * Since: 1.0 156 */ 157 public int getMaximumSize() 158 { 159 return adw_clamp_get_maximum_size(adwClamp); 160 } 161 162 /** 163 * Gets the size above which the child is clamped. 164 * 165 * Returns: the size above which the child is clamped 166 * 167 * Since: 1.0 168 */ 169 public int getTighteningThreshold() 170 { 171 return adw_clamp_get_tightening_threshold(adwClamp); 172 } 173 174 /** 175 * Sets the child widget of @self. 176 * 177 * Params: 178 * child = the child widget 179 * 180 * Since: 1.0 181 */ 182 public void setChild(Widget child) 183 { 184 adw_clamp_set_child(adwClamp, (child is null) ? null : child.getWidgetStruct()); 185 } 186 187 /** 188 * Sets the maximum size allocated to the child. 189 * 190 * Params: 191 * maximumSize = the maximum size 192 * 193 * Since: 1.0 194 */ 195 public void setMaximumSize(int maximumSize) 196 { 197 adw_clamp_set_maximum_size(adwClamp, maximumSize); 198 } 199 200 /** 201 * Sets the size above which the child is clamped. 202 * 203 * Params: 204 * tighteningThreshold = the tightening threshold 205 * 206 * Since: 1.0 207 */ 208 public void setTighteningThreshold(int tighteningThreshold) 209 { 210 adw_clamp_set_tightening_threshold(adwClamp, tighteningThreshold); 211 } 212 }